package drds.global_transaction;

import com.caucho.hessian.client.HessianProxyFactory;
import drds.common.Author;
import drds.common.Constants;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Author(name = Authors.LI_YANG)
public class HessianFactory<T>
{
    public static final String serviceRootUrl = "http://localhost:8080/service/";

    public static void main(String[] args) throws Exception
    {

    }

    public static Object get(Class clazz) throws Exception
    {
        String url = serviceRootUrl + clazz.getSimpleName();
        if (Constants.developMode){
            log.debug(url);
        }
        HessianProxyFactory hessianProxyFactory = new HessianProxyFactory();
        return hessianProxyFactory.create(clazz, url);
    }
}
